package codeGenerate.def;

import java.util.ResourceBundle;

public class CodeResourceUtil {

	private static final ResourceBundle bundle = ResourceBundle .getBundle("ian/ian_database");
	private static final ResourceBundle bundlePath = ResourceBundle.getBundle("ian/ian_config");
	public static String DIVER_NAME = "oracle.jdbc.driver.OracleDriver";
	public static String URL;
	public static String USERNAME = "uav";
	public static String PASSWORD = "uav2015";
	public static String DATABASE_NAME = "UAV";
	public static String DATABASE_TYPE = "oracle";
	public static String DATABASE_TYPE_MYSQL;
	public static String DATABASE_TYPE_ORACLE;
	public static String IAN_UI_FIELD_REQUIRED_NUM = "4";
	public static String IAN_UI_FIELD_SEARCH_NUM = "3";
	public static String web_root_package;
	public static String source_root_package;
	public static String bussiPackage;
	public static String bussiPackageUrl;
	public static String entity_package;
	public static String page_package;
	public static String ENTITY_URL;
	public static String PAGE_URL;
	public static String ENTITY_URL_INX;
	public static String PAGE_URL_INX;
	public static String TEMPLATEPATH = getTEMPLATEPATH();
	public static String CODEPATH;
	public static String JSPPATH;
	public static String IAN_GENERATE_TABLE_ID = getIan_generate_table_id();
	public static String IAN_GENERATE_UI_FILTER_FIELDS;
	public static String SYSTEM_ENCODING = getSYSTEM_ENCODING();

	public CodeResourceUtil() {
	}

	@SuppressWarnings("unused")
	private void ResourceUtil() {
	}

	public static final String getDIVER_NAME() {
		return bundle.getString("diver_name");
	}

	public static final String getURL() {
		return bundle.getString("url");
	}

	public static final String getUSERNAME() {
		return bundle.getString("username");
	}

	public static final String getPASSWORD() {
		return bundle.getString("password");
	}

	public static final String getDATABASE_NAME() {
		return bundle.getString("database_name");
	}

	private static String getBussiPackage() {
		return bundlePath.getString("bussi_package");
	}

	public static final String getEntityPackage() {
		return bundlePath.getString("entity_package");
	}

	public static final String getPagePackage() {
		return bundlePath.getString("page_package");
	}

	public static final String getTEMPLATEPATH() {
		return bundlePath.getString("templatepath");
	}

	public static final String getSourceRootPackage() {
		return bundlePath.getString("source_root_package");
	}

	public static final String getWebRootPackage() {
		return bundlePath.getString("webroot_package");
	}

	public static final String getSYSTEM_ENCODING() {
		return bundlePath.getString("system_encoding");
	}

	public static final String getIan_generate_table_id() {
		return bundlePath.getString("ian_generate_table_id");
	}

	public static final String getIan_generate_ui_filter_fields() {
		return bundlePath.getString("ian_generate_ui_filter_fields");
	}

	public static final String getIan_ui_search_filed_num() {
		return bundlePath.getString("ian_ui_search_filed_num");
	}

	public static final String getIan_ui_field_required_num() {
		return bundlePath.getString("ian_ui_field_required_num");
	}

	static {
		URL = "jdbc:oracle:thin:@192.168.1.25:1521:UAV";
		DATABASE_TYPE_MYSQL = "mysql";
		DATABASE_TYPE_ORACLE = "oracle";
		web_root_package = "WebRoot";
		source_root_package = "src";
		bussiPackage = "sun";
		bussiPackageUrl = "sun";
		entity_package = "entity";
		page_package = "page";
		DIVER_NAME = getDIVER_NAME();
		URL = getURL();
		USERNAME = getUSERNAME();
		PASSWORD = getPASSWORD();
		DATABASE_NAME = getDATABASE_NAME();
		source_root_package = getSourceRootPackage();
		web_root_package = getWebRootPackage();
		bussiPackage = getBussiPackage();
		bussiPackageUrl = bussiPackage.replace(".", "/");
		IAN_UI_FIELD_SEARCH_NUM = getIan_ui_search_filed_num();
		if (URL.indexOf("mysql") >= 0 || URL.indexOf("MYSQL") >= 0)
			DATABASE_TYPE = DATABASE_TYPE_MYSQL;
		else if (URL.indexOf("oracle") >= 0 || URL.indexOf("ORACLE") >= 0)
			DATABASE_TYPE = DATABASE_TYPE_ORACLE;
	}
}